package a04_字符串;

import java.util.Scanner;

/**
 * <p>
 * a05_右旋字符串
 * </p>
 *
 * @author flyduck
 * @since 2024-07-11
 */
public class a05_右旋字符串 {

    //abcdefg  fgabcde 2
    public static String rightSwap(String s,int k){
        char[] chars = s.toCharArray();
        reverse(chars, 0, chars.length - 1);
        reverse(chars, 0,k - 1);
        reverse(chars, k, chars.length - 1);
        return new String(chars);
    }

    public static void reverse(char[] chars,int leftIndex,int rightIndex){
        while (leftIndex < rightIndex){
            char temp = chars[leftIndex];
            chars[leftIndex] = chars[rightIndex];
            chars[rightIndex]  = temp;

            leftIndex++;
            rightIndex--;
        }
    }



    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        String s = scanner.next();
        System.out.println(rightSwap(s, k));
    }
}
